package com.hdoit.ares.logical.acc.dao.impl;

import org.springframework.stereotype.Component;

import com.tennetcn.common.dao.base.IFinderExpression;
import com.tennetcn.common.dao.base.impl.SuperDao;
import com.tennetcn.common.utils.FinderExpressionFactory;
import com.hdoit.ares.logical.acc.dao.IRedEnvelopeRecordDao;
import com.hdoit.ares.logical.acc.model.RedEnvelopeRecord;
/**
 * @author      xieqixiu
 * @email       
 * @createtime  2018年01月03日 11:01:45
 * @comment
 */
@Component
public class RedEnvelopeRecordDaoImpl extends SuperDao<RedEnvelopeRecord> implements IRedEnvelopeRecordDao{

	@Override
	public RedEnvelopeRecord queryModelByJoinId(String receiverId,String joinId, String refreeId, String level, String category) {
		IFinderExpression finderExpression = FinderExpressionFactory.createExpression();
		
		finderExpression.select("*")
						.from(RedEnvelopeRecord.class)
						.andEq("receiverId", receiverId)
						.andEq("joinId", joinId)
						.andEq("refreeId", refreeId)
						.andEq("joinLevel", level)
						.andEq("category", category);
		
		
		return queryModel(finderExpression);
	}

	@Override
	public RedEnvelopeRecord queryModelByCategory(String receiverId,String joinId, String refreeId, String category) {
		IFinderExpression finderExpression = FinderExpressionFactory.createExpression();
		
		finderExpression.select("*")
						.from(RedEnvelopeRecord.class)
						.andEq("receiverId", receiverId)
						.andEq("joinId", joinId)
						.andEq("refreeId", refreeId)
						.andEq("category", category);
		
		
		return queryModel(finderExpression);
	}
	
	
}